import pytest
import requests
from send.Send import Send
from utils.read_yaml import read_yaml


class Test_buy_change:

    @pytest.mark.parametrize( "args", read_yaml("D:/Projects/接口自动化/data/buy_change.yaml")  )
    def  test_buy_change(self,args):
        se = Send()
        #获取登录用户
        login_username = args["username"]
        #使用指定用户登录
        session = se.ceshi_buy_login(login_username)

        exp = args["exp"]

        result = se.send_buy_change(session, args)

        assert result["code"] == 200 and result["body"]["code"] == exp